package vip.xiaonuo.modular.manage.storeorder.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import vip.xiaonuo.core.annotion.BusinessLog;
import vip.xiaonuo.core.annotion.Permission;
import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
import vip.xiaonuo.core.pojo.response.ResponseData;
import vip.xiaonuo.core.pojo.response.SuccessResponseData;
import vip.xiaonuo.modular.manage.biindexdata.param.BiIndexDataParam;
import vip.xiaonuo.modular.manage.storeorder.param.BiStoreOrderParam;
import vip.xiaonuo.modular.manage.storeorder.service.BiStoreOrderService;

import javax.annotation.Resource;
import java.io.IOException;

@RestController
public class BiStoreOrderController {


    @Resource
    private BiStoreOrderService biStoreOrderService;

    /**
     * 查询指标数据
     *
     * @author cy
     * @date 2022-07-28 19:22:40
     */
    @Permission
    @GetMapping("/biStoreOrder/page")
    @BusinessLog(title = "指标数据_查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(BiStoreOrderParam biStoreOrderParam) {
        return new SuccessResponseData(biStoreOrderService.storeDataListCHPage(biStoreOrderParam));
    }

    /**
     * 导入订单数据
     *
     * @author cy
     * @date 2022-07-28 19:18:50
     */
    @Permission
    @PostMapping("/biStoreOrder/upload")
    @BusinessLog(title = "导入订单数据", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData uploadExcel(MultipartFile file) throws IOException {
        biStoreOrderService.upload(file);
        return new SuccessResponseData();
    }
}
